<?php
declare(strict_types=1);

use Phinx\Migration\AbstractMigration;

final class AddIndexStepCategoryTypeInProjectStepCategoryConfirmConfigTable extends AbstractMigration
{
    public function up()
    {
        $this->table('project_step_category_confirm_config')
            ->addIndex(['type', 'project_id', 'step_category_id', 'confirm_user_id', 'step_category_type'], ['type' => 'unique', 'name' => 'idx_unique_type_project_step_category_user_step_category_type'])
            ->removeIndexByName('idx_unique_type_project_step_category_user')
            ->save();
    }

    public function down()
    {
        $this->table('project_step_category_confirm_config')
            ->addIndex(['type', 'project_id', 'step_category_id', 'confirm_user_id'], ['type' => 'unique', 'name' => 'idx_unique_type_project_step_category_user'])
            ->save();
    }
}

